package com.weharvest.edu.service.Impl;

import com.github.pagehelper.PageHelper;
import com.weharvest.edu.dao.mapper.BaseDaoMapper;
import com.weharvest.edu.entity.BackstageRole;
import com.weharvest.edu.service.BaseService;
import org.apache.ibatis.annotations.Param;
import org.aspectj.lang.annotation.Pointcut;
import org.hibernate.service.spi.ServiceException;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public abstract class BaseServiceImpl implements BaseService{

    @Resource
    private BaseDaoMapper baseDaoMapper;

    @PostConstruct
    private void initConfig() {
        this.baseDaoMapper = this.init();
    }

    //初始化加载器
    public abstract BaseDaoMapper init();


    @Override
    public <ModelType> List<ModelType> findByParams(Map<String,Object>params) {
        return baseDaoMapper.findByParams(params);
    }

    @Override
    public <ModelType> List<ModelType> findByMp(ModelType modelType, Map<String, Object> params) {
        return  baseDaoMapper.findByMp(modelType,params);
    }

    @Override
    public <ModelType> int add(ModelType modelType) throws ServiceException {
        return 0;
    }

    @Override
    public <ModelType> int addResultPrimary(ModelType modelType) throws ServiceException {
        return 0;
    }

    @Override
    public <ModelType> ModelType findById(ModelType modelType) throws ServiceException {
        return null;
    }

    @Override
    public <ModelType> List<ModelType> findByParam(ModelType modelType, Map<String, Object> params) throws ServiceException {
        return null;
    }

    @Override
    public <ModelType> List<ModelType> findByBatch(List<String> primary) throws ServiceException {
        return null;
    }

    @Override
    public <ModelType> int modifyById(ModelType modelType) throws ServiceException {
        return 0;
    }

    @Override
    public <ModelType> int modifyByParams(Map<String, Object> whereParams, Map<String, Object> setParams) throws ServiceException {
        return 0;
    }

    @Override
    public int findCount(Map<String, Object> params) throws ServiceException {
        return 0;
    }
}
